<!DOCTYPE html>
<html>
    <head>
        <title>qrcode</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<style>
	.demo{width:400px; margin:40px auto 0 auto; min-height:250px;margin-left: 70px;}
    .demo p{line-height:30px}
	#qrcode{margin-top:20px;height: 400px;display:none;}
	</style>
	</head>

	<body>
	<div class="demo">
   		<div id='imagQrDiv'></div>
		<div id="qrcode"></div>
   </div>
  
   
    <script src="./studentPhoneLogin/qrcode/jquery-3.3.1.min.js" type="text/javascript"></script>
    <script src="./studentPhoneLogin/qrcode/jquery.qrcode.min.js" type="text/javascript"></script>

    <script>
	
	   /*$(function(){

			//判断页面是否是在微信浏览器打开

			//对浏览器的UserAgent进行正则匹配，不含有微信独有标识的则为其他浏览器

			var useragent = navigator.userAgent;

			if (useragent.match(/MicroMessenger/i) != 'MicroMessenger') {

				window.location.href = "wxError.html";//若不是微信浏览器，跳转到温馨error页面

			}

		 })*/
	
	
	  $('#qrcode').qrcode({
	     width:200,
		 height:200,
		 text:"https://communal-integral-monster.ngrok-free.app/school/studentPhoneLogin/loginPage.html"
		 });
		 
		 function convertCanvasToImage(canvas) { 
				//新Image对象，可以理解为DOM 
				var image = new Image(); 
				// canvas.toDataURL 返回的是一串Base64编码的URL，当然,浏览器自己肯定支持 
				// 指定格式 PNG 
				image.src = canvas.toDataURL("image/png"); 
				return image; 
		 } 
				//获取网页中的canvas对象 
		 var mycanvas1=document.getElementsByTagName('canvas')[0]; 
				//将转换后的img标签插入到html中 
		 var img=convertCanvasToImage(mycanvas1); 
		 $('#imagQrDiv').append(img);//imagQrDiv表示你要插入的容器id

    </script>
	</body>
</html>